package cn.wolfcode.wolf2w.redis.util;


import cn.wolfcode.wolf2w.util.Consts;
import lombok.Getter;

/**
 * Redis的管理Key工具类
 */
@Getter
public enum Rediskeys {
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME * 60L),

    THUMBSUP_CODE("thumbsup_code", Consts.USER_INFO_TOKEN_VAI_TIME * 60L * 24 * 2),//点赞


    FAVOR_USER_CODE("favor_user_code", -1L),//收藏用户的攻略id集合


    Users_AllNums_CODE("users_allnums_code", -1L),//总访客量

    Users_DayNums_CODE("users_daynums_code", -1L),//当天访客量


    TOKEN_CODE("token_code", Consts.USER_INFO_TOKEN_VAI_TIME * 60L),

    STRATEGY_STATIS_VO("strategy_statis_vo", -1L);//攻略帖子六要素


    private String prefix;//Redis的Key前缀
    private Long time; //Redis的有效时间

    private Rediskeys(String prefix, Long time) {
        this.prefix = prefix;
        this.time = time;
    }

    public String join(String... values) {
        StringBuffer stringBuffer = new StringBuffer(80);
        stringBuffer.append(this.prefix);
        for (String value : values) {
            stringBuffer.append(":").append(value);
        }
        return stringBuffer.toString();
    }
}
